//===----------------------------------------------------------------------===//
// Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//===----------------------------------------------------------------------===//
/// A [Bird](https://en.wikipedia.org/wiki/Bird) is an organism belonging to a group constituting the class Aves.
module animal.Bird

import "Bird.pkl"

/// The name of this bird.
name: String

/// The features of this bird.
features: Features

/// Features of a specific bird.
class Features {
  /// Whether this bird can fly or not.
  flies: Boolean

  /// Whether this bird can sing or not.
  sings: Boolean

  /// Whether this bird can swim or not.
  swims: Boolean
}

/// A [Bird] that cannot fly.
typealias Landlocked = Features(flies == false)

/// The main [Person] of the series.
parrot: Bird = new {
  name = "Parrot"
  features {
    flies = true
    sings = true
    swims = false
  }
}

/// Creates a [Bird] with the given [_name], which cannot fly..
function FlightlessBird(_name: String): Bird = new {
  name = _name
  features {
    flies = false
  }
}
